import { getCourseInfo } from '../models'

export default {
  data() {
    return {
      infos: {},

      oldReviewState: 0,
      oldIsSelfGroup: 0,
    }
  },
  computed: {
    courseId() {
      return this.$route.params.courseId
    }
  },
  methods: {
    async $getCourseInfo() {
      const params = {
        id: this.courseId
      };
      try {
        const { data } = await getCourseInfo(params);
        this.infos = {
          ...data
        }
        this.oldReviewState = data.reviewState
        this.oldIsSelfGroup = data.isSelfGroup
      } catch (err) {
        this.isPageLoading = false;
        this.$message.error(err.message || err.message || '获取信息出错')
      }
    }
  },
  mounted() {
    this.$getCourseInfo()
  }
}
